<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.minshenglife.zanzan.pub.Config" %>
	<%
	String rootPath = Config.getProperty(Config.WX_BASEURL);//应用的根路径
	%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=rootPath%>">
    <title>日志统计</title>
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="StyleSheet" href="<%=rootPath%>/js/dtree/dtree.css" type="text/css" />
	<script type="text/javascript" src="<%=rootPath%>/jsp/power/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="<%=rootPath%>/jsp/power/js/WdatePicker.js"></script>
<script type="text/javascript" src="<%=rootPath%>/js/dtree/dtree.js"></script>
<script type="text/javascript">
// $(function(){
// 	$.ajax({
<%-- 		url:"<%=rootPath%>/ExportWordCon/getDept_name.power", --%>
// 		type: 'post',
// 		dataType: "TEXT",
// 		async: false,
// 		success: function (obj){
// 			var data=$.parseJSON(obj);
// 			if(data.msg[0].state=="200"){
// 				for(var i = 0; i < data.data.length; i++){
// 		  			if(data.data[i].dept_id == $("#dept_id").val()){
// 		  				$("<option selected value='"+data.data[i].dept_id+"'>"+data.data[i].dept_name+"</option>").appendTo("#dept");
// 		  			}else{
// 		  				$("<option value='"+data.data[i].dept_id+"'>"+data.data[i].dept_name+"</option>").appendTo("#dept");
// 		  			}
// 	  			}
// 			}else{
// 			alert('fail',data.msg);
// 		}
			
// 		}
// 	})
// })
 	function resetConditions(){
 		// document.getElementById("dept").selectedIndex=0;
 		  var depts = document.getElementsByName("dept");
 		  for (var i = 0; i < depts.length; i++) {
			depts[i].checked = false;
		  }
          document.getElementById("startDate").value='';
          document.getElementById("endDate").value='';
          document.getElementById("emp_name").value="";
	}
	function exportWorkCon(){
		var startDate = document.getElementById("startDate").value;
        var endDate = document.getElementById("endDate").value;
		startDate = startDate.replace(/-/g,"/");
        var startDate = new Date(startDate);
		var startYear = startDate.getFullYear();
        var startMonth = startDate.getMonth()+1;
		var startDay = startDate.getDate();
		//alert(startYear+"------"+startMonth+"----"+startDay);
		endDate = endDate.replace(/-/g,"/");
        var endDate = new Date(endDate);
		var endYear = endDate.getFullYear();
        var endMonth = endDate.getMonth()+1;
        var endday = endDate.getDate();
        //alert(endYear+"------"+endMonth+"----"+endday);
        var nowDate = new Date();
        //alert(nowDate>endDate);
        //alert(startDay<endday);
        if(startYear==endYear&&startMonth==endMonth&&startDay<=endday&&nowDate>=endDate){
        	exportForm.submit();
        }else{
        	alert("时间有错误请从新输入 ，必须在同一月内且开始时间小于结束时间");
        }
		
            
    }
</script>
  </head>
  <body>
    <form id="exportForm" method="post" action="<%=rootPath%>/ExportWordCon/downLoadExcel.power">
           <p>注：请在一个月的范围之内  ，不能超出当月的范围</p>
           	<p>${error}</p>
           <table width="100%" cellpadding="0" cellspacing="0" border="0" >
               <tr>
                   <td align="left">
                       <table cellpadding="0" cellspacing="0" border="0">
  <%--                   <tr>
                               <td width="100px" bgcolor="#DDDDDD"><span>部门：</span></td>
                              
                               <td>
                                    <input type="hidden"  name="dept_id" id="dept_id"/>
                                    <select  name="dept" id="dept"  value="" style="width:182px">
                                       <option value="">
	                                       <c:choose>
											   <c:when test="${dept_name != null}">  
											      ${dept_name}
											   </c:when>
											   <c:otherwise> 
											   		民生保险全部部门
											   </c:otherwise>
											</c:choose>
										</option>
                                   </select></td></td>
                           </tr>
                            --%>  
                           <tr>
                               <td width="100px" bgcolor="#DDDDDD"><span>部门：</span></td>
                              
                               <td> <div class="dtree">
									<p><a href="javascript: mytree.openAll();">全部展开</a> | <a href="javascript: mytree.closeAll();">全部关闭</a></p>
	
                                   <script type="text/javascript">
                                   var iconUrl = {
                               			root				: '<%=rootPath%>/js/dtree/img/base.gif',
                               			folder			: '<%=rootPath%>/js/dtree/img/folder.gif',
                               			folderOpen	: '<%=rootPath%>/js/dtree/img/folderopen.gif',
                               			node				: '<%=rootPath%>/js/dtree/img/page.gif',
                               			empty				: '<%=rootPath%>/js/dtree/img/empty.gif',
                               			line				: '<%=rootPath%>/js/dtree/img/line.gif',
                               			join				: '<%=rootPath%>/js/dtree/img/join.gif',
                               			joinBottom	: '<%=rootPath%>/js/dtree/img/joinbottom.gif',
                               			plus				: '<%=rootPath%>/js/dtree/img/plus.gif',
                               			plusBottom	: '<%=rootPath%>/js/dtree/img/plusbottom.gif',
                               			minus				: '<%=rootPath%>/js/dtree/img/minus.gif',
                               			minusBottom	: '<%=rootPath%>/js/dtree/img/minusbottom.gif',
                               			nlPlus			: '<%=rootPath%>/js/dtree/img/nolines_plus.gif',
                               			nlMinus			: '<%=rootPath%>/js/dtree/img/nolines_minus.gif'
                               		};
                                  	 mytree = new dTree('mytree',iconUrl);
                                  	 mytree.config.useRadio = true;  //设置有单选按钮
                                  	
                                   	 ${treeMap}
                           		
                           			 document.write(mytree);
                                   </script>
                                   </div>
                               </td>
                           </tr>
                           <tr>
                               <td width="100px" bgcolor="#DDDDDD"><span>起始时间：</span></td>
                              
                               <td><input type="text" readonly="readonly" id='startDate' name="startDate" style="width:178px" class="datepicker" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/></td>
                               <td class="BLANK_TD"></td>
                               <td width="100px" bgcolor="#DDDDDD"><span>结束时间：</span></td>
                               <td width="5px"></td>
                               <td><input type="text" readonly="readonly" id='endDate' name="endDate" style="width:178px" class="datepicker" onClick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})"/></td>
                           </tr>
                            <tr>
                               <td class="BLANK_TD"></td>
                           </tr>
                       </table>
                   </td>
               </tr>
               <tr>
                   <th colspan="6">
                       <input id="search" type="button" value="导出excel表格" onclick="exportWorkCon()" onmouseover="this.style.background='#FFF18B'" onmouseout="this.style.background='#F1EDD2'"/>
                       <input id="reset" type="button" onclick="resetConditions()" value="重置" onmouseover="this.style.background='#FFF18B'" onmouseout="this.style.background='#F1EDD2'"/> 
                   </th>
               </tr>
           </table>
       </form>
  </body>
</html>
